<script setup>
import {useRoute} from "vue-router"
import {ref, onUpdated, onMounted} from "vue"

let id = ref(0)
let language = ref("")

// route.query接收键值对传参
let route = useRoute()
// 解决初始化为0问题
onMounted(()=>{
  id.value = route.query.id
  language.value = route.query.language
})

// 有点问题，初始进来时，不会涉及到其更新操作
onUpdated(()=>{
  id.value = route.query.id
  language.value = route.query.language
})



</script>

<template>
  <div>
    <h3>{{id}} {{language}}是世界上最好的语言</h3>
  </div>
 
</template>

<style scoped>

</style>
